<%-- 
    Document   : newjsp1
    Created on : 26.11.2011, 22:59:26
    Author     : Artem
--%>

<%@page import="java.util.Date"%>
<%@page import="javax.naming.NamingException"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="javax.naming.Context"%>
<%@page import="encaps.entities.MovieLocal"%>
<%@page import="encaps.entities.MovieLocalHome"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body><%
        MovieLocalHome mHome = null;
        MovieLocal p = null;
        try {
            Context ctx = new InitialContext();
            mHome = (MovieLocalHome) ctx.lookup("java:comp/env/ejb/Movie");
            p = mHome.findByPrimaryKey(new Long(1));
//            p = mHome.create("mov1", "PIC1","DESCRIPT1111111111");
    //       mHome.remove(new Long(4));        
//            p.addComment(new Long(2), "IM THIRD One!!!", new Date());            
//            p.removeComment(new Long(18));                        
            p.addRating(new Double(4.5), new Long(1), new Date());
        } catch(NamingException e) {
      throw new ServletException("Error looking up home", e);}
//    } catch(CreateException e) {
//      throw new ServletException("Error creating local hello bean", e);
    
         %>
        <h1>Hello ADD!</h1>
    </body>
</html>
